package com.etong.frame.directive.util;

public class CommonStatus {

	public static final Integer DIRECTIVE_CREATE_ERROR = 61001;
	public static final Integer DIRECTIVE_CHECK_ERROR = 61002;
	public static final Integer DIRECTIVE_BUILD_ERROR = 61003;
	public static final Integer DIRECTIVE_EXEC_ERROR = 61004;
	public static final Integer DIRECTIVE_NO_FOUND = 61005;
	public static final Integer DIRECTIVE_CREATE_EXISTS = 61006;
	public static final Integer UNKNOW_ERROR = 70001; 

	private String msg = "succeed";
	private String toast = "操作成功";
	private int status = 0;
	private Object object;

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public void error(int status, String msg) {
		this.status = status;
		this.setMsg(msg);
		this.toast = "操作失败";
		this.setObject(null);
	}

	public void error(int status, String msg, String toast) {
		this.status = status;
		this.setMsg(msg);
		this.setToast(toast);
		this.setObject(null);
	}

	public boolean succeed() {
		return 0 == status;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getObject() {
		return object;
	}

	public void setObject(Object object) {
		this.object = object;
	}

	public String getToast() {
		return toast;
	}

	public void setToast(String toast) {
		this.toast = toast;
	}

}
